var denglu=document.querySelector(".member div span:nth-of-type(1)")
var zhuce=document.querySelector(".member div span:nth-of-type(3)")
denglu.style.cursor="pointer"
zhuce.style.cursor="pointer"
denglu.onclick=function(){
var yemian=document.querySelector('.login')
yemian.style.visibility='visible'




}
zhuce.onclick=function(){
    var yemian=document.querySelector('.login')
    yemian.style.visibility='visible'
        
    
    }
var guanbi=document.querySelector('.form p i')
   guanbi.style.cursor='pointer'
    
    guanbi.onclick=function(){
        var yemian=document.querySelector('.login')
     
        yemian.style.visibility='hidden'
    }
var tuozhuai=document.querySelector('.item .menu')
tuozhuai.style.cursor="move"
//console.log(tuozhuai)
tuozhuai.onmousedown=function(event){
    olde= event ||window.event
    
    
   
    document.onmousemove=function(event){
        var xixi=document.querySelector('.item')
        event= event ||window.event
       var  left=event.clientX-olde.offsetX
        var top=event.clientY-olde.offsetY
        
        if(left<0) left=0
      
        if(top<0) top=0
       
        maxleft=(document.documentElement.clientWidth||window.innerWidth)-xixi.offsetWidth
        maxtop=(document.documentElement.clientHeight||window.innerHeight)-xixi.offsetHeight
        if(top>maxtop) top=maxtop
        if(left>maxleft) left=maxleft
        
   xixi.style.position='absolute'
  xixi.style.left=left+'px'
   xixi.style.top=top+"px"
     
    }
    document.onmouseup=function(){
        document.onmousemove=null
      
    }
   
    }
var ma=document.querySelector('button.captcha')

var num1=60
ma.onclick=function(){
 
    var guan=document.querySelector('h2 .icon-close')
    guan.style.cursor='pointer'
    guan.onclick=function(){
        yan.style.visibility='hidden'
    }

    var yan=document.querySelector('section.captcha')
   
      yan.style.visibility='visible'
    

  var niu=document.querySelector('.drag .btn')
  
  niu.onmousedown=function(event){
    
   
       document.onmousemove=function(event){
        event=event||window.event
        a=event.clientX-(yan.offsetLeft-yan.offsetWidth/2)
        if(a<0) a=0
        if(a>346) a=346
          left=a+"px"
          
          niu.style.left=left
          
          tu=document.querySelector('.check img:nth-of-type(2)')
        
          tu.style.left=a+"px"}
          document.onmouseup=function(){
            document.onmousemove=null
           var value=parseInt(niu.style.left)
            if(value<=264&&value>=260){
                //123
                yan.style.visibility='hidden'
             ma.innerText=num1+"s重新发送"
             ma.disabled=true
             
             cc=setInterval(function(){
              
                
                  if(num1<=1){
                     clearInterval(cc)
                      ma.innerText='重新发送'
                      num1=60
                      ma.disabled=false
                      return
                     
                  }
                  num1--
         
                  ma.innerText=num1+"s重新发送"
                 
             },1000)
            
            }
            niu.style.left='0px'
            tu.style.left='0px'
    
         }
        
       }
       return 
    }
        var sub=document.querySelector('.submit')
        
        sub.onclick=function(){
           var bao=document.querySelector('.mobile')
           var bei=document.querySelector('.password')
           var pOne=document.querySelector('.form p:nth-of-type(3)')
           var pTwo=document.querySelector('.form p:nth-of-type(4)')
           var ok=0
           
            if(bao.value==''||bao.value.length!=11||!Number(bao.value)){
                pOne.innerText="手机号码错误"
                
        
            }
            else{
                pOne.innerText=""
                
                ok++
            }
            if(bei.value==''||bei.value.length!=4||!Number(bei.value)){
                pTwo.innerText="验证码错误"
              
        
            }
            else{
                pTwo.innerText=""
             
                ok++
            }
            if(ok==2){
                alert('恭喜')
            }
        }
        //
       

     






      



  